<!DOCTYPE html>

<html lang="cn">
	<head>
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
        <title>@yield('title')</title>

        <meta name="csrf-token" content="{{ csrf_token() }}">

        <meta name="format-detection" content="telephone=no" />
        <meta content="yes" name="apple-mobile-web-app-capable" />
        <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height" />

        <link rel="icon" type="image/x-icon" href="{{ asset('favicon.ico') }}">

        @if(Request::path() != 'good/list')
        <link rel="stylesheet" type="text/css" href="{{ asset('fontpage/css/style.css') }}"/>
        @endif

        <link href="{{ asset('fontpage/css/main.css') }}" rel="stylesheet" />
        <link rel="stylesheet" href="{{ asset('fontpage/css/jquery-impromptu.css') }}" />
        <link rel="stylesheet" href="{{ asset('fontpage/css/new_main.css') }}" />
        <script src="{{ asset('fontpage/js/jquery-1.10.1.min.js') }}"></script>
        <script src="{{ asset('fontpage/js/jquery-impromptu.min.js') }}"></script>

		<script src="https://cdn.bootcss.com/layer/3.1.0/mobile/layer.js"></script>
		<script type="text/javascript">
		var uid = {{intval(Auth::id())}};
		layer.msg = function(msg){
			layer.open({
			      content: msg
			      ,skin: 'msg'
			      ,time: 2 //2秒后自动关闭
			    });
		}
$(function(){
	$.ajaxSetup({
	    headers: { 'X-CSRF-TOKEN' : '{{ csrf_token() }}' }
	});
	@if($errors)
		@foreach($errors->all() as $row)
			@if ($loop->first)
				layer.open({
				      content: '{{$row}}'
				      ,skin: 'msg'
				      ,time: 2 //2秒后自动关闭
				    });
            @endif
		@endforeach

	@endif
	@if(session('success'))
		layer.msg("{{session('success')}}");
    @endif
})


function ajaxurl(url, data, success, type='post')
{
	var index = layer.open({
		    type: 2
		    ,content: '加载中'
		  });
	$.ajax({ url: url, type: type, data: data, dataType:'json', success: function(res){
		layer.close(index);
		success(res);

	}, error: function(res){
		layer.close(index);
		var messages = (eval('(' + res.responseText + ')'));
		if(messages.message && messages.message == 'Unauthenticated.'){
			layer.open({
			      content: "{{translate('请登录')}}"
			      ,skin: 'msg'
			      ,time: 2
			    });
			setTimeout(function(){  //使用  setTimeout（）方法设定定时2000毫秒
				window.location.href='/login';//页面刷新
			},2000);
		}
		if(messages.errors){
			var m = messages.errors;
			for(var i in m) {
				layer.msg(m[i][0])
				return false;
			}
		}
	}});
}

function getQueryString(name) {
	  var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i"); // 匹配目标参数
	  var result = window.location.search.substr(1).match(reg); // 对querystring匹配目标参数
	  if (result != null) {
	    return decodeURIComponent(result[2]);
	  } else {
	    return null;
	  }
	}
		</script>


    </head>
<body>

@section('header')
@show
@yield('content')

@section('footer')
@show


</body>
</html>
